package com.sistemagestion.DAOsqlite;

import android.database.sqlite.SQLiteDatabase;

import com.sistemagestion.DAO.DaoFactory;

public class SqliteDaoFactory extends DaoFactory{
	
	private SQLiteDatabase database; 
	@Override
	public SQLiteDatabase open() {
		String dbPath = "mnt/sdcard/sistemagestion.sqlite";
		if (database == null || !database.isOpen())
			database = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READWRITE|SQLiteDatabase.NO_LOCALIZED_COLLATORS);
		return database;
	}

	@Override
	public void close() {
		database.close();
	}

	@Override
	public void beginTransaction() {
		database.beginTransaction();
	}

	@Override
	public void endTransaction() {
		database.endTransaction();
	}

	@Override
	public void rollBack() {
		database.endTransaction();
		
	}
	@Override
	public void commit(){
		database.setTransactionSuccessful();
		database.endTransaction();
	}
	

	@Override
	public void backUp() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void restore() {
		// TODO Auto-generated method stub
		
	}

	
		

}
